import Util from '../utils/util'

export default class WeiXin {
  static updateAppMessageShareData (config = {}) {
    // eslint-disable-next-line no-undef
    wx.ready(() => {
      // eslint-disable-next-line no-undef
      wx.showMenuItems({
        menuList: ['menuItem:share:appMessage', 'menuItem:share:timeline', 'menuItem:share:qq', 'menuItem:share:QZone']
      })
      // eslint-disable-next-line no-undef
      wx.updateAppMessageShareData(config)
      // eslint-disable-next-line no-undef
      wx.updateTimelineShareData(config)
    })
  }

  static ShareToWeiXin (config = {}, fun = () => {
  }) {
    Util.setupWebViewJavascriptBridge(() => {
      // eslint-disable-next-line no-undef
      WebViewJavascriptBridge.callHandler('shareClick', config, fun)
    })
  }
}
